import { defineStore } from 'pinia';
import { ref, computed } from 'vue';

const storeSetup = () => {
  /* 定义数据--------------------------------------------------------------------- */
  // 本年度份额占比数据
  const shareRatioData = ref({});

  // 本年度销售数据
  const salesData = ref([]);

  // 本年度销售趋势
  const salesTendencyData = ref([]);

  // 杭州销售数据
  const hangzhouSalesData = ref([]);

  // 实时销售数据
  const realOrderData = ref([]);

  // 优秀人员
  const excellentPersonnel = ref([
    {
      label: '张三',
      value: 102,
    },
    {
      label: '李四',
      value: 85,
    },
    {
      label: '王五',
      value: 96,
    },
    {
      label: '赵六',
      value: 115,
    },
    {
      label: '孙七',
      value: 108,
    },
  ]);

  // 优秀站点
  const excellentSite = ref([
    {
      label: '九堡站点',
      value: 205,
    },
    {
      label: '钱塘站点',
      value: 150,
    },
    {
      label: '西湖站点',
      value: 176,
    },
    {
      label: '星桥站点',
      value: 128,
    },
    {
      label: '大运河站点',
      value: 165,
    },
  ]);

  // 本年度份额占比 loading 标识
  const isShareRatioLoading = ref(false);

  // 本年度销售数据 loading 标识
  const isSalesLoading = ref(false);

  // 本年度销售趋势 loading 标识
  const isSalesTendencyDataLoading = ref(false);

  // 杭州销售数据 loading 标识
  const isHangzhouSalesDataLoading = ref(false);

  // 优秀站点 loading 标识
  const isExcellentSiteLoading = ref(false);

  // 优秀人员 loading 标识
  const isExcellentPersonnelLoading = ref(false);

  // 实时销售数据
  const isRealOrderDataLoading = ref(false);

  /* 定义函数--------------------------------------------------------------------- */

  // 返回参数
  return {
    shareRatioData,
    salesData,
    salesTendencyData,
    hangzhouSalesData,
    realOrderData,
    excellentPersonnel,
    excellentSite,
    isShareRatioLoading,
    isSalesLoading,
    isSalesTendencyDataLoading,
    isHangzhouSalesDataLoading,
    isExcellentSiteLoading,
    isExcellentPersonnelLoading,
    isRealOrderDataLoading,
  };
};

// 导出Store
export const useLargeDataScreenStore = defineStore(
  'largeDataScreen',
  storeSetup,
  { persist: false }
);
